<template>
  <div>
    <el-form style="width:380px;padding:20px 0px">
      <el-form-item label="订单来源">
        <el-select v-model="order.paymentWay" placeholder="请选择订单来源 ">
          <el-option value="修理厂">修理厂</el-option>
          <el-option value="天猫">天猫</el-option>
          <el-option value="天猫平台">天猫平台</el-option>
          <el-option value="淘宝">淘宝</el-option>
          <el-option value="微信小程序">微信小程序</el-option>
          <el-option value="中保车服">中保车服</el-option>
          <el-option value="北高峰">北高峰</el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="车牌号">
        <el-input v-model="order.carPlate" style="width:300px;"></el-input>
      </el-form-item>

      <el-form-item label="预检时间">
        <el-date-picker
          v-model="order.placeTestTime"
          type="datetime"
          placeholder="选择日期时间"
          value-format="yyyy-MM-dd HH:mm:ss"
        >
        </el-date-picker>
      </el-form-item>

      <el-form-item label="实付价格">
        <el-input v-model="order.price" type="number"></el-input>
      </el-form-item>

      <el-form-item label="客户姓名">
        <el-input v-model="order.customerName"></el-input>
      </el-form-item>

      <el-form-item label="客户电话">
        <el-input v-model="order.customerPhone"></el-input>
      </el-form-item>

      <el-form-item label="居住地址">
        <pickArea @getSite="getCity"></pickArea>
        <el-input v-model="order.address"></el-input>
      </el-form-item>

      <el-form-item label="备注">
        <el-input
          type="textarea"
          :rows="2"
          placeholder="请输入备注"
          v-model="order.textarea"
        >
        </el-input>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click="createOrder">立即创建</el-button>
         <el-button>取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import pickArea from "../pickArea.vue";
export default {
  inject:["reload"],
  components: {
    pickArea,
  },
  data: function () {
    return {
      order: {},
    };
  },
  methods: {
    getCity: function (province, city, area) {
      this.order.province = province;
      this.order.city = city;
      this.order.area = area;
    },
    createOrder:function(){
      this.$http.post("/order/placeCStoreOrder",this.order).then(res=>{
        if(res.data.code){
          this.$message.success("订单已录入成功，棒棒哒～加油哦，打工人");
          this.reload();
        }

      })
    },
  },
};
</script>

<style>
</style>